<%@ page contentType="text/html;charset=UTF-8"%>
<%@ taglib prefix="vtc" uri="/ls-trade-tags"%>
<%@ taglib prefix="s" uri="/struts-tags"%>

<html>
<head>
	<title>Roll Over</title>
	
	<script type="text/javascript">
		function clickBtn(action) {
			switch (action) {
			case "search":
				$("#mainForm_search").attr("value", "true");
				break;
			case "clear":
				$("#mainForm_search").attr("value", "false");
				break;
			}
	
			$("#mainForm").submit();
		}
		function turnToRolloverPlanningPage(imageId,planningLevel){
			switch (planningLevel){
			case "FirstLevel":
			window.location="rollover!input.action?archivedImage.id="+imageId;
			break;
			case "SecondLevel":
			window.location="rollover!inputLevel2.action?archivedImage.id="+imageId;
			break;
			case "ThirdLevel":
			window.location="rollover!inputLevel3.action?archivedImage.id="+imageId;
			break;
			}
		}
	</script>
</head>
<body>

<div class="content">
	<div class="pageTitle">Rollover Planning</div>
	<div class="form1">
	<s:form id="mainForm" name="mainForm" method="post"
			action="rollover.action">
			<s:hidden name="search"></s:hidden>
		<table border="0" cellspacing="0" cellpadding="0">
		<tr> 
	<s:fielderror> 
   </s:fielderror> 
	</tr>
			<tr>
				<td class="sep"><img src="../images/spacer.gif"
					style="width: 180px;" /></td>
				<td class="sep sep2"><img src="../images/spacer.gif" /></td>
			</tr>
			<tr>
				<td><label class="fLabel">Planning Exercise</label>
					<div class="fField">
						<s:select id="planningExercise" name="archivedImage.planningExercise"
								list="categoryService.planYearList"
								listKey="key" listValue="value" headerKey="" headerValue="-All-"
								cssStyle="width: 250px;"></s:select>
					</div></td>
				<td><label class="fLabel">Level of Planning</label>
					<div class="fField">
						<s:select id="planningLevel" name="archivedImage.planning.planningLevel"
								list="@com.lightsaber.trade.as.entity.planning.PlanningLevel@list()"
								listKey="key" listValue="value" headerKey="" headerValue="-All-"
								cssStyle="width: 250px;"></s:select>
					</div></td>
			</tr>
			<tr>
				<td colspan="2"><label class="fLabel">Archived Image
						Name</label>
					<div class="fField">
							<s:textfield id="name" name="archivedImage.name" cssStyle="width: 500px" ></s:textfield>
					</div></td>
			</tr>
		</table>
		<div class="btnSet btnSetTypeB">
			<div class="left">
				<div class="button">
					<div class="left">
						<div class="right">
							<input class="inputButton" type="button" id="" name=""
								value="Search" onclick="clickBtn('search')" />
						</div>
					</div>
				</div>
				<div class="button">
					<div class="left">
						<div class="right">
							<input class="inputButton" type="button" id="" name=""
								value="Clear" onclick="clickBtn('clear')" />
						</div>
					</div>
				</div>
			</div>
		</div>
	</div>
	<!-- InstanceBeginEditable name="content" -->
<s:if test="%{page!=null&&page.result!=null&&page.result.size()!=0}">
		<div class="sListBorder">
			<div class="sList">
				<table width="100%" class="sTable" cellpadding="0" cellspacing="0"
					border="0">
					<tr>
						<td class="sTh t">Planning Exercise</td>
						<td class="sTh t">Level of Planning</td>
						<td class="sTh t">Archived Image Name</td>
						<td class="sTh t">Remarks</td>
						<td class="sTh t">Creation Date</td>
						<td class="sTh t">Action</td>
					</tr>

					<s:iterator value="page.result" var="image" status="st">

						<s:set var="trClass" value="'sRow1'"></s:set>
						<s:if test="#st.index%2==0">
							<s:set var="trClass" value="'sRow2'"></s:set>
							<s:else>
								<s:set var="trClass" value="'sRow1'"></s:set>
							</s:else>
						</s:if>
						<tr class="<s:property value='#trClass'/>">
							<td class="sCell"><s:property
									value="#image.planningExercise" /></td>
							<td class="sCell"><s:property
									value="#image.planning.planningLevel" /></td>
							<td class="sCell"><s:property value="#image.name" /></td>
							<td class="sCell"><s:property value="#image.remarks" /></td>
							<td class="sCell"><s:date name="#image.createdDate" format="yyyy-MM-dd" /></td>
							<td class="sCell buttonCell"><div class="button sbtn">
									<div class="left">
										<div class="right">
											<input class="inputButton" type="button" id="" name=""
												value="Rollover"
												onclick="turnToRolloverPlanningPage('<s:property value='#image.id'/>','<s:property value='#image.planning.planningLevel'/>')" />
										</div>
									</div>
								</div>
							</td>
					</s:iterator>
				</table>
			</div>
			  <vtc:paging page="%{page}"></vtc:paging>
		</div>
	</s:if>
</s:form>
	<!-- InstanceEndEditable -->
</div>


</body>
</html>